using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using FSS.DAL.DBManagers;
using FSS.BLL.Entities;
namespace FSS.BLL.Services
{
    #region IDistrictService

    /// <summary>
    /// DistrictService object for Ibatis mapped table 'District'.
    /// </summary>
    public class IDistrictService : BaseSqlMapDao
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(IDistrictService).Name);

        public IList<DistrictEntity> LoadAll()
        {
            try
            {
                return ExecuteQueryForList<DistrictEntity>("DistrictLoadAll", null);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        public DistrictEntity LoadByPrimaryKey(DistrictEntity objE)
        {
            try
            {
                return ExecuteQueryForObject<DistrictEntity>("DistrictLoadByPrimaryKey", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        public IList<DistrictEntity> DistrictLoadbyCityID(DistrictEntity objE)
        {
            try
            {
                return ExecuteQueryForList<DistrictEntity>("DistrictLoadbyCityID", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        /// <summary>
        /// add new District to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Insert(DistrictEntity objE)
        {
            try
            {
                ExecuteInsert("DistrictInsert", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        /// <summary>
        /// update District to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Update(DistrictEntity objE)
        {
            try
            {
                ExecuteUpdate("DistrictUpdate", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        /// <summary>
        /// delete District to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Delete(DistrictEntity objE)
        {
            try
            {
                ExecuteDelete("DistrictDelete", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
    }
    #endregion
}
